-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/inconsistent screenshot height #397
Conversation
e362351
to
dac9662
Compare
core/jobs/src/main/java/com/cognifide/aet/job/common/utils/Sampler.java
Outdated
Show resolved
Hide resolved
*/ | ||
public static <T> T waitForValue(Supplier<T> samplesSupplier, int samplingPeriod, | ||
int sampleQueueSize, int maxSamplesThreshold) { | ||
LinkedList<T> samplesQueue = new LinkedList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider using org.apache.commons.collections.buffer.CircularFifoBuffer
? I think you can use it here to simplify your code :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion! I have updated the code.
3c32a98
to
f096cfc
Compare
f096cfc
to
675de4c
Compare
Tested, OK! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I think it's OK to only make the "samplingPeriod" a configurable parameter
...jobs/src/main/java/com/cognifide/aet/job/common/modifiers/resolution/ResolutionModifier.java
Outdated
Show resolved
Hide resolved
.checkRange(height, 1, MAX_SIZE, | ||
"Height should be greater than 0 and smaller than " + MAX_SIZE); | ||
} else { | ||
samplingPeriod = Optional.ofNullable(params.get(SAMPLING_PERIOD_PARAM)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no limit for the samplingPeriod
.
Just a question here: shouldn't that be limited somehow?
What will happen if user sets here e.g. 10000000 ms
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, there should be a range for this param. I will set max at 10 seconds. Please give suggestion if the value seems reasonable.
9efdd9c
to
16d944f
Compare
Add algorithm to enable taking long screenshots without resolution-sleep-resolution workaround.
Description
This is a proposed solution no. 2 from issue #357. An algorithm that takes samples of page height in defined periods of time.
Adds new param to
<screen/>
calledsamplingPeriod
, which defined waiting time between taking samples.Please give suggestions if all proposed default values in algorithm are ok, and if some of them should be configurable or not:
samplingPeriod
- 100ms (configurable)Please note, this pr is supposed to be merged after #387. There are several todos in code that indicate the tests should be changed to test proper page heights.
Motivation and Context
Fixed #357
Types of changes
Checklist:
I hereby agree to the terms of the AET Contributor License Agreement.